package com.xjc.business.controller.schadmin;

import com.xjc.business.entity.vo.schadmin.HomeViewDataVo;
import com.xjc.business.service.BuildingsService;
import com.xjc.business.service.CollegesService;
import com.xjc.business.service.SchoolHomeService;
import com.xjc.business.service.StudentsService;
import com.xjc.system.constants.MyConstants;
import com.xjc.system.exception.MyException;
import com.xjc.system.result.Result;
import com.xjc.system.result.ResultCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 徐锦程
 * 时间:2025-02-18 17:33
 */
@RestController
@RequestMapping("/sch_admin/home")
public class SchoolHomeController {

    @Autowired
    SchoolHomeService schoolHomeService;

    /**
     * 获取首页可视化数据
     * @param schoolId 学校id
     * @return Result<HomeViewDataVo>
     */
    @GetMapping("/viewData/{schoolId}")
    public Result<HomeViewDataVo> getHomeViewData(@PathVariable(value = "schoolId",required = false) Integer schoolId){
        if (schoolId == null){
            throw new MyException(ResultCode.SUCCESS.getCode(), MyConstants.PARAM_MISSING);
        }

        return schoolHomeService.getHomeViewData(schoolId);
    }
}
